﻿<%@ Page Language="C#" MasterPageFile="~/GestorEventos.Master" AutoEventWireup="true" CodeBehind="listArtistas.aspx.cs" Inherits="GestorEventos.WebForm3" Title="Untitled Page" %>
<%@ Import Namespace="Business" %>
<%@ Import Namespace="System.Collections.Generic" %>


<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="UserArea" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Main" runat="server">

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<table>


<%  ListaArtista business = new ListaArtista();
    ListaArtista listaArtistas = new ListaArtista();
    Artista art = new Artista();
    if (Request.QueryString["list"] != null) {
        int list = Convert.ToInt32(Request.QueryString["list"].ToString());
        if (list == 0 || list == 1 || list == 2)
        {
            listaArtistas = business.getListaArtista(list);
        }
    
    } else {
        
            listaArtistas = business.getListaArtista(-10);
    }
    //Response.Write(" cenassa: " + Convert.ToString(listaArtistas.getListaArtistas()[5].getNomeArtista()));
    
    List<Artista> lart = listaArtistas.getListaArtistas();
    int i=0;
    while(i<lart.Count+1)
    {
       
    %>
        <tr>
            <td>
                <asp:Label ID="LabelNome" runat="server"></asp:Label>
                <%if(i==lart.Count)
                      LabelNome.Text = lart[i-1].getNomeArtista();
                  else
                    LabelNome.Text = lart[i].getNomeArtista(); %>
            </td>
            <td>
            <asp:HyperLink ID="HyperLink" runat="server"></asp:HyperLink>
            <%  HyperLink.Text = "Consultar";
                if(i==lart.Count)
                    HyperLink.NavigateUrl = "viewArtista.aspx?artistID=" + lart[i-1].getIDArtista() + "";
                else
                    HyperLink.NavigateUrl = "viewArtista.aspx?artistID=" + lart[i].getIDArtista() + ""; %>            
            </td>
            
            <td>
                <asp:Label ID="LabelStatus" runat="server"></asp:Label>
            <% 
                int st = 0;
                if (i == lart.Count)
                    st = i - 1;
                else
                    st = i;            
                switch (lart[st].getStatusArtista())
                {
                    case 0: LabelStatus.Text = "Removido";
                        break;
                    case 1: LabelStatus.Text = "Aprovado";
                        break;
                    case 2: LabelStatus.Text = "Em revisão";
                        break;
                }%>
            </td>
        </tr>        
    <% i++;
    }
   // Response.Write("Last: " + lart[i - 1].getNomeArtista());
    %>
    </table>
    <table>
    <tr>
            <td>
                <asp:Label ID="Label10" runat="server"></asp:Label>
                <% Label10.Text=i.ToString(); %>
            </td>
            
     </tr>        
     </table>

</asp:Content>
